package com.chenxi.vhr.controller.config;

import com.chenxi.vhr.bean.BaseUser;
import com.chenxi.vhr.bean.common.Result;
import com.chenxi.vhr.service.BaseMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : zhangchenxi
 * @create : 2022-01-29
 **/
@RestController
@RequestMapping("/sys/config")
public class SysConfigController {

    @Autowired
    BaseMenuService baseMenuService;

    @GetMapping("/menu")
    public Result menuList() {
        BaseUser baseUser = (BaseUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return Result.ok("", baseMenuService.getMenuListByUserId(baseUser.getId()));
    }


}
